<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>美嘉饲料</title>
<link href="<%=basePath%>skin/css/public.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath%>skin/css/validform/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=basePath%>skin/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="<%=basePath%>skin/js/jquery.event.drag-1.5.min.js"></script>
<script type="text/javascript" src="<%=basePath%>skin/js/jquery.touchSlider.js"></script>
<script type="text/javascript" src="<%=basePath%>skin/js/public.js"></script>
<script type="text/javascript" src="<%=basePath%>skin/js/common.js"></script>
<script type="text/javascript" src="<%=basePath%>skin/js/validform/Validform_v5.3.2_min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	banner()
	navi()	
	loginmask()
	floatmenu()
	
	//验证
	 var validform = $("#form1").Validform({
		btnSubmit:"#save",
		tiptype:3
	 });
	 validform.addRule([
		{
		    ele:"#username",
		    datatype:"*",
		    nullmsg:"请输入用户名！"
		},
		{
		    ele:"#password",
		    datatype:"*",
		    nullmsg:"请输入密码！"
		}
	 ]);
	 
	 $("#register").click(function(){
		var redirectUrl = encodeURI("${redirectUrl }");
		window.location.href="<%=basePath%>register.shtml?redirectUrl="+redirectUrl;
	 });
}); 
</script>

</head>
<body>
	<div class="index">
    	<div class="container">
        	<div class="header-wrap">
            	<c:import url="/layouts/top.jsp" />
                <c:import url="/layouts/head.jsp" />
                <div class="nav-warp">
					<div class="nav-main-warp wp">
						<div class="head-v3">
							<div class="navigation-up">
								<div class="navigation-inner">
									<div class="navigation-v3">
										<ul>
											<li class="fLeft navi_product first" _t_nav="product">
												<h2>
													<a href="<%=basePath%>shop/product/list.shtml">全部产品
														<img src="<%=basePath%>skin/images/all-product-arrow.png" />
													</a>
												</h2>
											</li>
											<li class="nav-up-selected-inpage fLeft" _t_nav="home">
												<h2>
													<a href="<%=basePath%>">美嘉商城</a>
												</h2>
											</li>
											<li class="fLeft self_community" _t_nav="community">
												<h2>
													<a href="javascript:void(0)">美嘉社区</a>
												</h2>
											</li>
											<li class="fLeft technology" _t_nav="technology">
												<h2>
													<a href="#">饲养技术</a>
												</h2>
											</li>
											<li class="fLeft server" _t_nav="server">
												<h2>
													<a href="">美嘉服务</a>
												</h2>
											</li>
											<li class="fLeft know" _t_nav="know">
												<h2>
													<a href="aboutMJ.html">了解美嘉</a>
												</h2>
											</li>
											<li class="fLeft navi_cart" _t_nav="cart">
												<h2>
													<a href="<%=basePath%>cart/list.shtml">
														<img src="<%=basePath%>skin/images/cart-icon.png" />购物车（<span id="cartnum">0</span>）
													</a>
												</h2>
											</li>
										</ul>
									</div>
								</div>
							</div>
							<div class="navigation-down">
								<div id="product" class="nav-down-menu menu-1"
									style="display: none;" _t_nav="product">
									<div class="navigation-down-inner">
										<c:forEach items="${productCategoryTree }" var="productCategory">
											<c:if test="${productCategory.grade == 0 }">
												<div class="navi-down-area">
													<a href="<%=basePath%>shop/product/list.shtml?productCategoryId=${productCategory.id }" class="product-cate">
														<img src="<%=basePath%>download.shtml?filepath=${productCategory.source}" />
													</a>
													<ul>
														<li><a href="<%=basePath%>shop/product/list.shtml?productCategoryId=${productCategory.id }">${productCategory.name}</a></li>
														<div class="clear"></div>
													</ul>
												</div>
											</c:if>
										</c:forEach>
									</div>
								</div>
								
								<div id="community" class="nav-down-menu menu-3" style="display: none;" _t_nav="community">
                                    <div class="navigation-down-inner">
                                    	<div class="navi-down-area-second">
                                        	<a href="<%=basePath%>forumTopic/list.shtml" class="product-cate"><img src="<%=basePath%>skin/images/mjbbs.png" /></a>
                                        </div>
                                        <div class="navi-down-area-second">
                                        	<a href="<%=basePath%>collegeTopic/list.shtml" class="product-cate"><img src="<%=basePath%>skin/images/mjschool.png" /></a>
                                        </div>
                                    </div>
                                </div>
							</div>
						</div>
					</div>
				</div>
            </div>
            <div class="content-wrap">
            	<div class="banner">
                    <div class="main_ad">
                        <div class="main_visual">
                            <div class="flicking_con">
                                <div class="flicking_inner">
	                                <c:forEach items="${indexImages }" var="lunboImage">
										<c:if test="${lunboImage.type == 0 && not empty lunboImage.source}">
											<a href="javascript:void(0)"></a>	
		                                </c:if>
	                                </c:forEach>
                                </div>
                                <a href="javascript:;" id="btn_prev"></a>
                                <a href="javascript:;" id="btn_next"></a>
                            </div>
                            <div class="main_image">
                                <ul>
									<c:forEach items="${indexImages }" var="lunboImage">
										<c:if test="${lunboImage.type == 0 && not empty lunboImage.source}">	
		                                    <li><a href="${lunboImage.url}" ><span style="background:url(<%=basePath%>download.shtml?filepath=${lunboImage.source}) center top no-repeat;"></span></a></li>
		                                </c:if>
	                                </c:forEach>
                                </ul>
                            </div>
                        </div>
                        <div style="text-align:center;clear:both"></div>
                    </div>
                </div>
                <div class="product-cate-wrap">
                	<div class="wp product-cate-list">
	                	<c:forEach items="${indexImages }" var="fenleiImage">
							<c:if test="${fenleiImage.type == 1 && not empty fenleiImage.source}">
		                        <div class="last">
			                        <a href="${fenleiImage.url }">
										<img src="<%=basePath%>download.shtml?filepath=${fenleiImage.source}"/>
									</a>
								</div>
	                        </c:if>
                        </c:forEach>
                    </div>
                </div>
                <div class="home-new-goods wp">
                <div class="xm-plain-box">
                    <div class="box-hd">
                        <h3 class="title">新品上架</h3>
                        <div class="more">
                            <a class="more-link" href="<%=basePath%>shop/product/list.shtml">更多></a>
                        </div>
                    </div>
                    <div class="box-bd">
                        <div class="row">
                            <div class="col col-15">
                                <div class="brick-list">
                                    <div class="brick-item brick-item-l">
                                        <div class="item">
                                            <div class="item-content">
												<c:forEach items="${indexImages }" var="newImage">
													<c:if test="${newImage.type == 3 && not empty newImage.source}">
														<c:if test="${newImage.orders == 1 }">
															<span class="item-thumb"><a href="${newImage.url}"><img src="<%=basePath%>download.shtml?filepath=${newImage.source}"></a></span>
														</c:if>
													</c:if>
												</c:forEach>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="brick-item brick-item-m">
                                        <div class="item">
                                            <div class="item-content">
												<c:forEach items="${indexImages }" var="newImage">
													<c:if test="${newImage.type == 3 && not empty newImage.source}">
														<c:if test="${newImage.orders == 2 }">
															<span class="item-info">
			                                                    <span class="item-title"><a href="${newImage.url}">${newImage.title}</a></span>
			                                                    <span class="item-price">
				                                                    <fmt:formatNumber value="${newImage.price}" pattern="0.00"/>元
				                                                    <c:if test="${not empty newImage.promotionPrice && newImage.promotionPrice > 0}">
				                                                    	<del><fmt:formatNumber value="${newImage.promotionPrice}" pattern="0.00"/>元</del>
				                                                    </c:if>
			                                                    </span>
			                                                </span>
			                                                <span class="item-thumb"><a href="${newImage.url}"><img src="<%=basePath%>download.shtml?filepath=${newImage.source}"></a></span>
														</c:if>
													</c:if>
												</c:forEach>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="brick-item brick-item-m">
                                        <div class="brick-item brick-item-s">
                                            <div class="item">
                                                <div class="item-content">
													<c:forEach items="${indexImages }" var="newImage">
														<c:if test="${newImage.type == 3 && not empty newImage.source}">
															<c:if test="${newImage.orders == 3 }">
																<span class="item-info">
				                                                    <span class="item-title"><a href="${newImage.url}">${newImage.title}</a></span>
				                                                    <span class="item-price">
					                                                    <fmt:formatNumber value="${newImage.price}" pattern="0.00"/>元
					                                                    <c:if test="${not empty newImage.promotionPrice && newImage.promotionPrice > 0}">
					                                                    	<del><fmt:formatNumber value="${newImage.promotionPrice}" pattern="0.00"/>元</del>
					                                                    </c:if>
				                                                    </span>
				                                                </span>
				                                                <span class="item-thumb"><a href="${newImage.url}"><img src="<%=basePath%>download.shtml?filepath=${newImage.source}"></a></span>
															</c:if>
														</c:if>
													</c:forEach>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="brick-item brick-item-s">
                                            <div class="item">
                                                <div class="item-content">
													<c:forEach items="${indexImages }" var="newImage">
														<c:if test="${newImage.type == 3 && not empty newImage.source}">
															<c:if test="${newImage.orders == 4 }">
																<span class="item-info">
				                                                    <span class="item-title"><a href="${newImage.url}">${newImage.title}</a></span>
				                                                    <span class="item-price">
					                                                    <fmt:formatNumber value="${newImage.price}" pattern="0.00"/>元
					                                                    <c:if test="${not empty newImage.promotionPrice && newImage.promotionPrice > 0}">
					                                                    	<del><fmt:formatNumber value="${newImage.promotionPrice}" pattern="0.00"/>元</del>
					                                                    </c:if>
				                                                    </span>
				                                                </span>
				                                                <span class="item-thumb"><a href="${newImage.url}"><img src="<%=basePath%>download.shtml?filepath=${newImage.source}"></a></span>
															</c:if>
														</c:if>
													</c:forEach>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
									<c:forEach items="${indexImages }" var="newImage">
										<c:if test="${newImage.type == 3 && not empty newImage.source}">
											<c:if test="${newImage.orders > 4 &&  newImage.orders < 10 }">
											<div class="brick-item brick-item-m">
	                                        	<div class="item">
		                                            <div class="item-content">
														<span class="item-info">
		                                                    <span class="item-title"><a href="${newImage.url}">${newImage.title}</a></span>
		                                                    <span class="item-price">
			                                                    <fmt:formatNumber value="${newImage.price}" pattern="0.00"/>元
			                                                    <c:if test="${not empty newImage.promotionPrice && newImage.promotionPrice > 0}">
			                                                    	<del><fmt:formatNumber value="${newImage.promotionPrice}" pattern="0.00"/>元</del>
			                                                    </c:if>
		                                                    </span>
		                                                </span>
		                                                <span class="item-thumb"><a href="${newImage.url}"><img src="<%=basePath%>download.shtml?filepath=${newImage.source}"></a></span>
	                                                </div>
		                                        </div>
		                                    </div>
											</c:if>
										</c:if>
									</c:forEach>
                                </div>
                            </div>
                            <div class="col col-5">
                                <div class="channel-section">
                                    <ul class="channel-list">
										<c:forEach items="${indexImages }" var="newImage">
											<c:if test="${newImage.type == 3 && not empty newImage.source}">
												<c:if test="${newImage.orders == 10 }">
													<li id="J_secKillGoods">
			                                        	<a href="${newImage.url}" >
				                                        	<span class="item-info">
				                                            	<span class="item-title"></span>
			                                                    <span class="item-price">
				                                                    <fmt:formatNumber value="${newImage.price}" pattern="0.00"/>元
				                                                    <c:if test="${not empty newImage.promotionPrice && newImage.promotionPrice > 0}">
				                                                    	<del><fmt:formatNumber value="${newImage.promotionPrice}" pattern="0.00"/>元</del>
				                                                    </c:if>
			                                                    </span>
				                                                <span class="item-desc">还有更多特价商品</span>
				                                                <span class="item-thumb"><img src="<%=basePath%>download.shtml?filepath=${newImage.source}"></span>
																<span class="item-flag">
				                                                <span class="icon-flag">特价商品</span>
				                                            </span>
														</a>
													</li>																		
												</c:if>
											</c:if>
										</c:forEach>
                                    </ul>
                                </div>
                                <div>
									<c:forEach items="${indexImages }" var="newImage">
										<c:if test="${newImage.type == 3 && not empty newImage.source}">
											<c:if test="${newImage.orders == 11 }">
												<img src="<%=basePath%>download.shtml?filepath=${newImage.source}">
											</c:if>
										</c:if>
									</c:forEach>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="home-hot-goods wp">
                <div class="xm-plain-box">
                    <div class="box-hd">
                        <h3 class="title">大家都喜欢</h3>
                    </div>
                    <div class="box-bd">
                        <div class="row">
                            <div class="col col-15">
                                <div class="brick-list">
                                    <div class="brick-item brick-item-l">
                                        <div class="item">
                                            <div class="item-content">
												<c:forEach items="${indexImages }" var="likeImage">
													<c:if test="${likeImage.type == 2 && not empty likeImage.source}">
														<c:if test="${likeImage.orders == 1  }">
					                                    	<span class="item-thumb"><a href="${likeImage.url}"><img src="<%=basePath%>download.shtml?filepath=${likeImage.source}"></a></span>
														</c:if>
													</c:if>
												</c:forEach>
                                            </div>
                                        </div>
                                    </div>
									<c:forEach items="${indexImages }" var="likeImage">
										<c:if test="${likeImage.type == 2 && not empty likeImage.source}">
											<c:if test="${likeImage.orders > 1 &&  likeImage.orders < 6 }">
											<div class="brick-item brick-item-m">
	                                        	<div class="item">
		                                            <div class="item-content">
														<span class="item-info">
		                                                    <span class="item-title"><a href="${likeImage.url}">${likeImage.title}</a></span>
		                                                    <span class="item-price">
			                                                    <fmt:formatNumber value="${likeImage.price}" pattern="0.00"/>元
			                                                    <c:if test="${not empty likeImage.promotionPrice && likeImage.promotionPrice > 0}">
			                                                    	<del><fmt:formatNumber value="${likeImage.promotionPrice}" pattern="0.00"/>元</del>
			                                                    </c:if>
		                                                    </span>
		                                                </span>
		                                                <span class="item-thumb"><a href="${likeImage.url}"><img src="<%=basePath%>download.shtml?filepath=${likeImage.source}"></a></span>
	                                                </div>
		                                        </div>
		                                    </div>
											</c:if>
										</c:if>
									</c:forEach>
                                </div>
                            </div>
                            <div class="col col-5">
                                <div class="board-section">
                                    <h3>
                                        <span>HOT</span>热销商品排行
                                    </h3>
                                    <ul class="board-list">
                                        <c:set var="hot" value="0" />
										<c:forEach items="${indexImages }" var="hotImage">
											<c:if test="${hotImage.type == 4 && not empty hotImage.source}">
		                                        <li class="top">
		                                            <span class="item-info"> 
		                                                <span class="item-title"><a href="${hotImage.url}">${hotImage.title}</a></span>
		                                            </span> 
		                                            <span class="item-thumb"><a href="${hotImage.url}"><img src="<%=basePath%>download.shtml?filepath=${hotImage.source}" width="950" height="400" title="${hotImage.title}"/></a></span> 
		                                            <span class="item-num">${hot+1 }</span>
		                                        </li>
		                                        <c:set var="hot" value="${hot+1 }" />
											</c:if>
										</c:forEach>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            </div>
			<c:import url="/layouts/foot.jsp" />
        </div>
    </div>
	<!--登陆-->
    <div class="login-mask" id="login-mask">
    	<div class="login-mask-main">
    		<form id="form1" name="form1" method="post" action="<%=basePath%>login/sumbit.shtml">
				<input type="hidden" id="redirectUrl" name="redirectUrl" value="${redirectUrl }"/>
	        	<input class="login-mask-input" name="username" type="text" placeholder="手机号" />
	            <input class="login-mask-input" name="password" type="password" placeholder="密码"  />
	            <a href="javascript:void(0)" class="login-mask-btn" id="save">登陆</a>
	            <div class="login-tips">暂无账号？请<a href="javascript:void(0)" id="register">注册</a></div>
	        </form>
        </div>
        <a href="#" class="login-mask-close"></a>
    </div>
    <!--返回顶部-->
    <div class="right_menu">
        <div class="leftsead">
            <ul>
            	<li><a class="leftsead_li_a qrcode" href="javascript:void(0)"><img src="<%=basePath%>skin/images/right_menu_qr_code.png" class="hides"/><img src="<%=basePath%>skin/images/right_menu_qr_code.png" class="shows" /></a></li>
                <li><a class="leftsead_li_a" href="<%=basePath%>member/order/list.shtml"><img src="<%=basePath%>skin/images/right_menu_order_on.png" class="hides"/><img src="<%=basePath%>skin/images/right_menu_order.png" class="shows" /></a></li>
                <li><a class="leftsead_li_a" href="<%=basePath%>member/index.shtml"><img src="<%=basePath%>skin/images/right_menu_user_center_on.png" class="hides"/><img src="<%=basePath%>skin/images/right_menu_user_center.png" class="shows" /></a></li>
                <li><a class="leftsead_li_a top_btn"><img src="<%=basePath%>skin/images/right_menu_to_top_on.png" class="hides"/><img src="<%=basePath%>skin/images/right_menu_to_top.png" class="shows" /></a></li>
            </ul>
        </div>
	</div>   
</body>
</html>
